package com.sm.healthy.data.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sm.healthy.data.bean.OxygenEntity

@Dao
interface OxygenDao {

    @Insert
    suspend fun insert(oxygenEntity: OxygenEntity)

    @Update
    suspend fun update(oxygenEntity: OxygenEntity)

    @Delete
    suspend fun delete(oxygenEntity: OxygenEntity)

    @Query("DELETE FROM oxygen")
    suspend fun deleteAll()

    @Query("SELECT * FROM oxygen")
    fun getOxygen(): LiveData<List<OxygenEntity>>

    @Query("SELECT * FROM oxygen WHERE timeLong >:before and timeLong <:after")
    fun getOxygenByTime(before: Long, after: Long): LiveData<List<OxygenEntity>>
}